package pro.cherish.knowledgewebflux.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pro.cherish.knowledgewebflux.service.HelloService;
import pro.cherish.knowledgewebflux.util.ThreadContextHandler;
import reactor.core.publisher.Mono;

/**
 * @author finefine at: 2019-06-01 15:02
 */
@RestController
@Api(tags = "测试")
@RequestMapping("/api/")
public class HelloController {
    @Autowired
    private HelloService helloService;

    @ApiOperation(value = "测试mono",notes = "测试mono")
    @GetMapping("mono")
    public Mono<String> mono() {
        ThreadContextHandler.set("name","lys");
        helloService.sayHello();
        return Mono.just("hello webflux");
    }
}